<?php 
	require_once ("../../config.php");
?>
<html>
<head>
<title>ITControl Masisa</title>
<link rel="stylesheet" href="/itcontrol/com/visual/style.css">
</head>
	<body>
		<div id="div_navbar" align="right">
			<?php 
				# Add div with Navbar
				echo navbar();
			?>
		</div>
		<div id="div_menu" align="left">
			<?php 				
				echo menu();
			?>
		</div>
		<div id="div_formtable" align="left">
			<form id="form_main" name="form_main" method="post" action="cc_list_db.php">
				<?php 
					
					$return = $_GET["return"];

					$table = "tb_cc";
					$ltable[0] = "tb_unit";
					$on[0] = "unit_id = tb_unit.id";
					
					$fields[0] = $table. ".id";
					$fields[1] = $table. ".nameCC";
					$fields[2] = $table. ".cc";
					$fields[3] = $ltable[0]. ".nameUnit";
					
					$namefields[0] = "ID";
					$namefields[1] = "Nome";
					$namefields[2] = "CC";
					$namefields[3] = "Unidade";
					
					if(!empty($return)){
						$where = explode(",", $return);
						
						echo tableDataLeftJoin($table ,"cc", "find", $fields, $namefields, $ltable, $on, $where);
						echo menureturn("cc", "find");
					}else{
						echo tableDataLeftJoin($table ,"cc", "list", $fields, $namefields, $ltable, $on);	
					}
				
				?>
			</form>
		</div>
	</body>
</html>